/*
 * Description: this class contains the methods to generate the excel report
 *              using the template1
 */

package exampleseverything.poi_jxls;

import org.apache.poi.xslf.usermodel.XSLFSheet;
import net.sf.jxls.transformer.XLSTransformer;
import net.sf.jxls.exception.ParsePropertyException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import exampleseverything.beans.Alumno;
import exampleseverything.beans.Columna;
import exampleseverything.logic.DataExtractor;
import exampleseverything.utils.ConstantsExEv;
import java.io.FileInputStream;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.usermodel.Workbook;

/**
 *
 * @author HellCoders
 */

public class ExcelGenerator1 implements ConstantsExEv {

    public static void generateReport()throws ParsePropertyException, IOException, InvalidFormatException {

           List<Alumno> alumnos = DataExtractor.getAlumnos(ConstantsExEv.ALUMNOS_FILE);
           List<Columna> columnas = DataExtractor.getColumnas(ConstantsExEv.COLUMNS_FILE);
           Map map = new HashMap();
           map.put("alumnos",alumnos);
           map.put("columnas",columnas);

           XLSTransformer transformer = new XLSTransformer();
           transformer.transformXLS(ConstantsExEv.TEAMPLATE_EX_ONE,map,ConstantsExEv.OUTPUT_EX_ONE);

           FileInputStream fis = new FileInputStream("src\\files\\output1.xls");
           POIFSFileSystem pfs = new POIFSFileSystem(fis);
           Workbook wb = new HSSFWorkbook(pfs);
    }
}
